home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Periodicals / develop / develop Issue 18 / develop 18 code / OSA Sample / Sources / SimpliFace.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-28  |  3.5 KB  |  124 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SimpliFace.h
  3.  
  4.     Contains:    Interface for a simple Scriptable application.
  5.  
  6.     Developed by:    
  7.         
  8.         Paul G Smith (commstalk hq & Full Moon Software, Inc)
  9.         
  10.         you can leave messages at (UK): 0727 844232; (US): 408 253 7199
  11.         BUT I prefer to be contacted by e-mail
  12.         AppleLink:     SMITH.PG
  13.         Internet:     SMITH.PG@applelink.apple.com
  14.         
  15.         "SimpliFace" Sample code to accompany develop article
  16.         on techniques for embedding scripts in applications.
  17.  
  18. */
  19.  
  20. #ifndef __SIMPLIFACE__
  21. #define __SIMPLIFACE__
  22.  
  23. #ifndef __APPLICATION__
  24. #include <Application.h>
  25. #endif
  26.  
  27. #ifndef __PASCALSTRING__
  28. #include "PascalString.h"
  29. #endif
  30.  
  31. #ifndef __LISTOFLONGS__
  32. #include "ListOfLongs.h"
  33. #endif
  34.  
  35. /**********************************************************************
  36. ** class TSimpliFace
  37. ***********************************************************************/
  38.  
  39. class TSimpliFace : public TApplication {
  40. public:
  41.                                 TSimpliFace(Ptr qdPtr);
  42.     virtual                        ~TSimpliFace();
  43.  
  44.     virtual    void                DoIdle();
  45.     virtual    void                AdjustMenus();
  46.     virtual    void                AdjustCursor();
  47.     virtual    void                DoMenuCommand(short menuID, short menuItem);
  48.     virtual    void                Terminate();
  49.  
  50.     virtual void                 DoActivateEvt();    
  51.     virtual void                 DoUpdateEvt();
  52.     virtual void                 DoGoAway();
  53.  
  54.     virtual    void                GetThisAppName(CStr255& appName);
  55.     
  56.     virtual Boolean             HandleContentClick (AEDesc *target, 
  57.                                             WindowPtr tWind, EventRecord& theEvent);
  58.     virtual Boolean             HandleGoAway (AEDesc *target, 
  59.                                             WindowPtr tWind);
  60.     virtual Boolean             HandleMenuCommand (AEDesc *target, 
  61.                                             short menuNum, short itemNum);
  62.     virtual Boolean             HandleMouseDown (AEDesc *target, 
  63.                                             EventRecord& theEvent);
  64.     virtual Boolean             HandleKeyDown (AEDesc *target, 
  65.                                             EventRecord& theEvent);
  66.     virtual Boolean             HandleEvent (EventRecord& theEvent, Boolean& pass);
  67.     // returns true if event was handled by aevt pre-handler
  68.     
  69.     virtual OSErr                CollectAETEs(short languageCode, AEDesc& resultDesc);
  70.     
  71.     virtual void                 SetUp();        // Run before event loop starts
  72.     virtual void                 CleanUp();        // run at end of loop
  73.     
  74.     // Returns total stack space required in bytes.
  75.     virtual long                 StackNeeded();
  76.     
  77.     // Returns total heap space required in bytes.
  78.     virtual long                 HeapNeeded();
  79.  
  80.     virtual unsigned long         SleepVal();        // how long to sleep in WaitNextEvent
  81.     
  82.     // AE object model support
  83.                                         
  84.     virtual  OSErr CountElements (DescType desiredClass,
  85.                                         long *result);
  86.                                         
  87.     virtual  OSErr ResolveContainer    (TScriptableObject **theContainerObj);
  88.  
  89.     virtual  OSErr ResolveElementByName(DescType desiredClass,
  90.                                         CStr255& nameStr,
  91.                                         TScriptableObject **theResultObj);
  92.                                         
  93.     virtual  OSErr ResolveElementByIndex(DescType desiredClass,
  94.                                         short theIndex,
  95.                                         TScriptableObject **theResultObj);
  96.     
  97.     virtual  OSErr GetProperty  (DescType propertyID, DescType wantType, AEDesc *result);
  98.  
  99.     virtual  OSErr SetProperty  (DescType propertyID, const AEDesc *theData);
  100.  
  101.     virtual     OSErr CreateNewElement    (DescType desiredClass,
  102.                                         DescType position,
  103.                                         AEDesc *theData,
  104.                                         AERecord *theProperties,
  105.                                         TScriptableObject *theContainerObj,
  106.                                         TScriptableObject **theNewObj);
  107.  
  108.                                         
  109.     virtual  OSErr GetTargetObjectSpecifier  (EventRecord& theEvent, AEDesc *result);
  110.     
  111. private:
  112.     TListOfLongs        fWindowObjects;
  113. };
  114.  
  115. /*    -----------------------------------------------------------------
  116.     inline methods
  117.     ----------------------------------------------------------------- */
  118.  
  119.  
  120. extern    TSimpliFace*    gSimpliFace;
  121.  
  122.  
  123. #endif
  124.